/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cq.bd.dwr;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.cq.base.domain.KeyLabel;
import com.cq.base.domain.Page;
import com.cq.bd.base.BaseDwr;
import com.cq.bd.domain.BInventory;
import com.cq.bd.domain.BTake;
import com.cq.bd.service.TakeSerive;

/**
 * 采血
 * 
 * @author huangmy
 * @date   2009-10-5
 */
public class TakeDwr extends BaseDwr {
    private static final long serialVersionUID = 1L;
    private TakeSerive takeSerive;

    /**
     * 采血登记
     * 
     * @param take
     */
    public void take(BTake take) {
        this.takeSerive.doTake(take);
    }
    
    /**
     * 修改采血记录
     * 
     * @param take
     */
    public void updateTake(BTake take) {
        this.takeSerive.doUpdateTake(take);
    }
    
    /**
     *  获取所有的采血记录
     * 
     * @return
     */
    public List<BTake> getTakes() {
        return this.takeSerive.doGetTakes();
    }
    
    /**
     *  获取采血记录
     * 
     * @return
     */
    public BTake getTake(Long bloodId) {
        return this.takeSerive.doGetTake(bloodId);
    }
    
    /**
     * 分页查询
     * 
     * @param filter
     * @param like
     * @param sort
     * @param pageNo
     * @param pageSize
     * @return
     */
    public Page pageTakes(Map<String, String> filter, Map<String, String> like, Map<String, String> sort, int pageNo, int pageSize){
        return this.takeSerive.pageTakes(filter, like, sort, pageNo, pageSize);    
    }
    
    /**
     * 分页查询
     * 
     * @param filter
     * @param like
     * @param sort
     * @param pageNo
     * @param pageSize
     * @return
     */
    public Page pageCondTakes(Map<String, String> filter, Map<String, String> like, Map<String, String> sort, int pageNo, int pageSize){
        return this.takeSerive.pageCondTakes(filter, like, sort, pageNo, pageSize);    
    }
    
    /**
     * 歌血型统计
     * 
     * @return
     */
    public List<KeyLabel> queryTakeTypeCount() {
        return this.takeSerive.queryTakeTypeCount();
    }
    
    /**
     * 当前血型库存量
     * 
     * @return
     */
    public List<BInventory> queryBloodResult() {
        return this.takeSerive.queryBloodResult();
    }
    
    /**
     * 血液库存
     * 
     * @param filter
     * @param like
     * @param sort
     * @param pageNo
     * @param pageSize
     * @return
     */
    public Page pageBloodResult(Map<String, String> filter, Map<String, String> like, Map<String, String> sort, int pageNo, int pageSize){
        List<BInventory> bis = this.takeSerive.queryBloodResult();
        Page page = new Page(bis, 0, bis.size(), bis.size());
        
        return page;
    }
    
    /**
     * 获取采血记录  姓名
     * 
     * @param name
     * @return
     */
    public List<BTake> getTakesByName(String name) {
        return this.takeSerive.doGetTakesByName(name);
    }
    
    /**
     * 获取采血记录  身份证号码
     * 
     * @param num
     * @return
     */
    public List<BTake> getTakesByNum(String num) {
        return this.takeSerive.doGetTakesByNum(num);
    }
    
    /**
     * 获取采血记录  血型
     * 
     * @param num
     * @return
     */
    public List<BTake> getTakesByType(String type) {
        return this.takeSerive.doGetTakesByType(type);
    }
    
    /**
     * 获取采血记录  采血者
     * 
     * @param num
     * @return
     */
    public List<BTake> getTakesByWorkerId(Long workerId) {
        return this.takeSerive.doGetTakesByWorkerId(workerId);
    }
    
    /**
     * 采血记录数 采血者
     * 
     * @param workerId
     * @return
     */
    public int queryTakesNumByWorkerId(Long workerId) {
        return this.takeSerive.doQueryTakesNumByWorkerId(workerId);
    }
    
    /**
     * 采血记录数 采血时间
     * 
     * @param beginTime
     * @param endTime
     * @return
     */
    public List<BTake> getTakesByTakeTime(Date beginTime, Date endTime) {
        return this.takeSerive.doGetTakesByTakeTime(beginTime, endTime);
    }
    
    /**
     * 采血记录数 采血地点
     * 
     * @param locationId
     * @return
     */
    public List<BTake> getTakesByTakeLocation(Long locationId) {
        return this.takeSerive.doGetTakesByTakeLocation(locationId);
    }

    public void setTakeSerive(TakeSerive takeSerive) {
        this.takeSerive = takeSerive;
    }
}
